Skip to content

to_execl xlwt fails on large files #2445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

jassinm
Copy link

@jassinm jassinm commented Dec 6, 2012

import pandas as pd
df = pd.DataFrame([tuple([i for i in range(200)]) for i in range(10000)], columns=["%s" % i for i in range(200)])
df.to_excel('test.xls')

python testlarge.pyTraceback (most recent call last):
  File "testlarge.py", line 9, in <module>
    df.to_excel('test.xls')
  File "/Volumes/Locodrive/Dev/.virtualenvs/pandasdev/lib/python2.7/site-packages/pandas-0.10.0.dev_67ef67f-py2.7-macosx-10.8-x86_64.egg/pandas/core/frame.py", line 1445, in to_excel
    startrow=startrow, startcol=startcol)
  File "/Volumes/Locodrive/Dev/.virtualenvs/pandasdev/lib/python2.7/site-packages/pandas-0.10.0.dev_67ef67f-py2.7-macosx-10.8-x86_64.egg/pandas/io/parsers.py", line 2068, in write_cells
    self._writecells_xls(cells, sheet_name, startrow, startcol)
  File "/Volumes/Locodrive/Dev/.virtualenvs/pandasdev/lib/python2.7/site-packages/pandas-0.10.0.dev_67ef67f-py2.7-macosx-10.8-x86_64.egg/pandas/io/parsers.py", line 2131, in _writecells_xls
    val, style)
  File "/Volumes/Locodrive/Dev/.virtualenvs/pandasdev/lib/python2.7/site-packages/xlwt/Worksheet.py", line 1032, in write
    self.row(r).write(c, label, style)
  File "/Volumes/Locodrive/Dev/.virtualenvs/pandasdev/lib/python2.7/site-packages/xlwt/Row.py", line 236, in write
    style_index = self.__parent_wb.add_style(style)
  File "/Volumes/Locodrive/Dev/.virtualenvs/pandasdev/lib/python2.7/site-packages/xlwt/Workbook.py", line 303, in add_style
    return self.__styles.add(style)
  File "/Volumes/Locodrive/Dev/.virtualenvs/pandasdev/lib/python2.7/site-packages/xlwt/Style.py", line 90, in add
    return self._add_style(style)[1]
  File "/Volumes/Locodrive/Dev/.virtualenvs/pandasdev/lib/python2.7/site-packages/xlwt/Style.py", line 149, in _add_style
    raise ValueError("More than 4094 XFs (styles)")
V

wesm added a commit that referenced this pull request Dec 7, 2012
@wesm
Copy link
Member

wesm commented Dec 7, 2012

Test suite fails

@jassinm
Copy link
Author

jassinm commented Dec 7, 2012

my bad sry. all green now

@jassinm
Copy link
Author

jassinm commented Dec 7, 2012

@wesm should we add a check that openpyxl 1.6.1 is installed. 1.5.3 for example does not have the ability to merge cells

@wesm
Copy link
Member

wesm commented Dec 7, 2012

That's probably a good idea

@wesm
Copy link
Member

wesm commented Dec 7, 2012

FWIW you might consider turning on Travis CI on your fork for continuous integration happiness

@jassinm
Copy link
Author

jassinm commented Dec 7, 2012

thanks will do. This pull fixes the above issue and should fix #2396 (2nd issue)

@wesm
Copy link
Member

wesm commented Dec 9, 2012

Merged, thanks!

@wesm wesm closed this Dec 9, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants